import { createRouter, createWebHistory } from 'vue-router'

const routes = [
    {
        path: '/',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/Index.vue'),
        meta: { title: '首页' }
    },
    {
        path: '/employee',
        name: 'Employee',
        redirect: '/employee/list',
        meta: { title: '员工管理' },
        children: [
            {
                path: 'list',
                name: 'EmployeeList',
                component: () => import('@/views/employee/List.vue'),
                meta: { title: '员工列表' }
            },
            {
                path: 'add',
                name: 'EmployeeAdd',
                component: () => import('@/views/employee/Add.vue'),
                meta: { title: '添加员工' }
            },
            {
                path: 'detail/:id',
                name: 'EmployeeDetail',
                component: () => import('@/views/employee/Detail.vue'),
                meta: { title: '员工详情' }
            },
            {
                path: 'edit/:id',
                name: 'EmployeeEdit',
                component:()=>import('@/views/employee/Edit.vue')
            }
        ]
    },
    {
        path: '/department',
        name: 'Department',
        redirect: '/department/list',
        meta: { title: '部门管理' },
        children: [
            {
                path: 'list',
                name: 'DepartmentList',
                component: () => import('@/views/department/List.vue'),
                meta: { title: '部门列表' }
            },
            {
                path: 'detail/:id',
                name: 'DepartmentDetail',
                component: () => import('@/views/department/Detail.vue'),
                meta: { title: '部门详情' }
            }
        ]
    },
    {
        path: '/attendance',
        name: 'Attendance',
        component: () => import('@/views/attendance/Index.vue'),
        meta: { title: '考勤管理' }
    },
    {
        path: '/salary',
        name: 'Salary',
        component: () => import('@/views/salary/Index.vue'),
        meta: { title: '薪资管理' }
    },
    {
        path: '/recruitment',
        name: 'Recruitment',
        component: () => import('@/views/recruitment/Index.vue'),
        meta: { title: '招聘管理' }
    },
    {
        path: '/training',
        name: 'Training',
        component: () => import('@/views/training/Index.vue'),
        meta: { title: '培训管理' }
    },
    {
        path: '/performance',
        name: 'Performance',
        component: () => import('@/views/performance/Index.vue'),
        meta: { title: '绩效管理' },
        children: [
            {
                path: 'list',
                name: 'PerformanceList',
                component: () => import('@/views/performance/Index.vue'),
                meta: { title: '绩效列表' }
            },
            {
                path: 'add',
                name: 'PerformanceAdd',
                component: () => import('@/views/performance/Add.vue'),
                meta: { title: '新增绩效评估' }
            },
            {
                path: 'detail/:id',
                name: 'PerformanceDetail',
                component: () => import('@/views/performance/Detail.vue'),
                meta: { title: '绩效详情' }
            },
            {
                path: 'edit/:id',
                name: 'PerformanceEdit',
                component: () => import('@/views/performance/Edit.vue'),
                meta: { title: '绩效评估' }
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes
})

export default router